package com.chen.paymentdemo.controller;

import com.chen.paymentdemo.service.ProductService;
import com.chen.paymentdemo.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author Y·C
 * @version 1.0.0
 * @ClassName ProductController.java
 * @Description TODO
 * @createTime 2023年07月19日 21:03:00
 */
@CrossOrigin
@Api(tags = "商品管理")
@RestController
@RequestMapping("/api/product")
public class ProductController {

    @Resource
    private ProductService productService;

    @ApiOperation("测试接口")
    @GetMapping("test")
    public R test() {
        return R.ok().data("test","test").data("date",new Date());
    }


    @ApiOperation("商品列表")
    @GetMapping("list")
    public R list() {
        return R.ok().data("productList",productService.list());
    }



}
